<div ng-controller="inquiryAddController">
    <div class="bg-light lter b-b wrapper-sm">
        <h1 class="m-n font-thin h4">{{inquiryName}}</h1>
    </div>
    <div class="wrapper-sm">
        <div class="panel panel-default">
            <div class="panel-body">
                <form id="inquiryForm" class="form-validation form-horizontal" novalidate>
                    <button ng-show="false"></button>
                    <ng-form name="inquiryForms">
                        <div class="form-group">
                            <div class="panel-heading font-bold m-t-n m-b-sm">
                                基本信息
                            </div>
                            <label class="col-lg-1 pull-left control-label">总询价单编号:</label>
                            <label class="col-lg-2 control-label text-left">{{inquiryId}}</label>
                            <label class="col-lg-1 pull-left control-label">紧急程度<span class="text-danger">*</span></label>
                            <div class="col-lg-1">
                                <input id="inquiryAdd_urgency" name="urgency" type="text" class="form-control input-sm" ng-model="urgency" placeholder="请填写紧急程度" ng-disabled="editInquiryDis || isInquiryDis">
                            </div>
                            <div class="pull-left m-l-n-sm">
                                <select id="inquiryAdd_urgencyUnit" class="form-control input-sm" ng-model="urgencyUnit" name="urgencyUnit" ng-options="x.value as x.text for x in urgencyUnitDropDown" ng-disabled="editInquiryDis || isInquiryDis" required>
                                    <option value="">请选择</option>
                                </select>
                            </div>
                            <label class="m-l-sm control-label">内回复</label>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-1 pull-left control-label">计划专员  :</label>
                            <label class="col-lg-2 control-label text-left">{{plannerName}}</label>
                            <label class="w-s m-l-sm pull-left control-label">商务专员<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <select class="form-control input-sm" id="inquiryAdd_businessOfficerId" ng-model="businessOfficerId" name="businessOfficerId" ng-options="x.id as x.realName for x in businessOfficerDropDown" ng-disabled="editInquiryDis || isInquiryDis" required>
                                    <option value="">请选择</option>
                                </select>
                            </div>
                            <label class="w-s m-l-sm pull-left control-label">客服专员<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <select class="form-control input-sm" id="inquiryAdd_customerServiceOfficerId" ng-model="customerServiceOfficerId" name="customerServiceOfficerId" ng-options="x.id as x.realName for x in serviceOfficerIdDropDown" ng-disabled="editInquiryDis || isInquiryDis" required>
                                    <option value="">请选择</option>
                                </select>
                            </div>
                            <label class="w-s pull-left control-label">调度专员<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <select class="form-control input-sm" id="inquiryAdd_dispatchOfficerId" ng-model="dispatchOfficerId" name="dispatchOfficerId" ng-options="x.id as x.realName for x in dispatchOfficerDropDown" ng-disabled="editInquiryDis || isInquiryDis" required>
                                    <option value="">请选择</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-1 pull-left control-label">客户单位<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <div angucomplete-alt id="client" placeholder="" pause="100" selected-object="clientSelect" remote-api-handler="searchClient" search-fields="name" title-field="name" minlength="1" input-class="form-control form-control-small input-sm" initial-value="clientName"
                                    name="clientName" match-class="highlight" disable-input="editInquiryDis || isInquiryDis" field-required="true">
                                </div>
                            </div>
                            <label class="w-s pull-left control-label">发货计划人<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <div angucomplete-alt id="consignor" placeholder="" pause="100" selected-object="consignorSelect" remote-api-handler="searchConsignor" search-fields="realName" title-field="realName" minlength="1" input-class="form-control form-control-small input-sm"
                                    initial-value="consignorName" name="consignorName" match-class="highlight" disable-input="editInquiryDis || isInquiryDis" field-required="true">
                                </div>
                            </div>
                            <label class="w-s pull-left control-label">发货人电话<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <input id="inquiryAdd_consignorPhone" name="consignorPhone" type="text" class="form-control input-sm" ng-model="consignorPhone" ng-pattern="/^1\d{10}$/" placeholder="请填写发货人电话" required disabled="disabled">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-1 pull-left control-label">总询价内容  :</label>
                            <div class="col-lg-10 pull-left control-label">
                                <textarea class="form-control input-sm" ng-model="content" placeholder="请填写总询价内容" ng-disabled="editInquiryDis || isInquiryDis" name="content"></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="panel-heading font-bold m-b-sm">
                                线路信息
                            </div>
                            <label class="col-lg-1 pull-left control-label">发货地址<span class="text-danger">*</span></label>
                            <div class="col-lg-10">
                                <tms-address class="pull-left" city-list="shipCityList" area-list="shipAreaList" province="startProvince" city="startCity" area="startArea" required="true" ischecked="ischecked">
                                </tms-address>
                                <div class="col-lg-4 m-l-n-sm">
                                    <input id="inquiryAdd_startAddress" name="startAddress" type="text" class="form-control input-sm" id="page_inquiry_add_startAddress" ng-model="startAddress" placeholder="请填写详细地址" required>
                                </div>
                            </div>
                            <div class="line  pull-in"></div>
                            <label class="col-lg-1 pull-left control-label">送货地址<span class="text-danger">*</span></label>
                            <div class="col-lg-10">
                                <tms-address class="pull-left" city-list="deliverCityList" area-list="deliverAreaList" province="endProvince" city="endCity" area="endArea" ischecked="ischecked" required="true">
                                </tms-address>
                                <div class="col-lg-4 m-l-n-sm">
                                    <input id="inquiryAdd_endAddress" name="endAddress" type="text" class="form-control input-sm" ng-model="endAddress" placeholder="请填写详细地址" required name="endAddress">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-1 pull-left control-label">预计发货时间<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <div class="input-group input-group-sm date">
                                    <input id="dataTime" name="plannedArrivalTime" datetimepicker plugintype="datetime" ng-model="plannedArrivalTime" placeholder="预计发货时间" class="form-control" type="text" required />
                                    <span id="opendataTime" class="input-group-addon curpoint">
                                        <span class="glyphicon glyphicon-calendar"></span>
                                    </span>
                                </div>
                            </div>
                            <label class="w-s pull-left control-label">预计到货时间<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <div class="input-group input-group-sm date">
                                    <input id="dataTimeEnd" name="plannedDeliveryTime" datetimepicker plugintype="datetime" ng-model="plannedDeliveryTime" placeholder="预计到货时间" class="form-control" type="text" required />
                                    <span id="opendataTimeEnd" class="input-group-addon curpoint">
                                        <span class="glyphicon glyphicon-calendar"></span>
                                    </span>
                                </div>
                            </div>
                            <label class="w-s pull-left control-label">里程数</label>
                            <div class="col-lg-2">
                                <input id="inquiryAdd_mileage" name="mileage" type="text" class="form-control input-sm" ng-model="mileage" ng-pattern="/^[+]?\d+\.?\d*$/" placeholder="请填写里程数">
                            </div>
                            <label class="control-label">公里</label>
                        </div>
                        <div class="form-group">
                            <div class="panel-heading font-bold m-b-sm">
                                货物信息
                            </div>
                            <label class="col-lg-1 pull-left control-label">货物类别<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <select id="inquiryAdd_goodsTypeName" class="form-control input-sm" ng-model="goodsTypeId" name="goodsTypeId" ng-change="goodsTypeSelect()" ng-options="x.id as x.name for x in goodsTypeDropDown" required>
                                    <option value="">请选择</option>
                                </select>
                            </div>
                            <label class="w-s pull-left control-label">货物名称<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <div angucomplete-alt id="goodsId" placeholder="" pause="100" selected-object="onGoodsNameSelected" remote-api-handler="onGoodsNameAutoComplate" search-fields="name" title-field="name" minlength="0" input-class="form-control form-control-small input-sm"
                                    initial-value="goodsName" match-class="highlight" field-required="true" input-name="goodsId" auto-match="true" focus-first="true">
                                </div>
                                <!-- <select class="form-control input-sm" id="inquiryAdd_goodsName" ng-model="goodsId" name="goodsId" ng-options="x.id as x.name for x in goodsNameDropDown" required>
                                    <option value="">请选择</option>
                                </select> -->
                            </div>
                            <label class="w-s pull-left control-label">货物数量<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <input id="inquiryAdd_goodsQuantity" name="goodsQuantity" type="text" ng-pattern="/^[0-9]+(\.[0-9]{1,4})?$/" class="form-control input-sm" id="goodsQuantity" ng-model="goodsQuantity" placeholder="请填写货物数量" required>
                            </div>
                            <div class="col-lg-2 m-l-n-sm">
                                <select class="form-control input-sm" id="inquiryAdd_goodsQuantityUnit" ng-model="goodsQuantityUnit" name="goodsQuantityUnit" ng-options="x.value as x.text for x in goodsQuantityUnitDropDown" required>
                                    <option value="">请选择</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="panel-heading font-bold m-b-sm">
                                所需车辆信息
                            </div>
                            <label class="col-lg-1 pull-left control-label">所需车辆<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <select id="inquiryAdd_carType" class="form-control input-sm" ng-model="carType" name="carType" ng-options="x.value as x.text for x in carTypeDropDown" required>
                                    <option value="">请选择</option>
                                </select>
                            </div>
                            <label class="w-s pull-left control-label">所需车长<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <select id="inquiryAdd_carLength" class="form-control input-sm" ng-model="carLength" name="carLength" ng-options="x.value as x.text for x in carLengthDropDown" required>
                                    <option value="">请选择</option>
                                </select>
                            </div>
                            <label class="w-s pull-left control-label">承运方式<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <select id="inquiryAdd_carrierCategory" class="form-control input-sm" ng-model="carrierCategory" name="carrierCategory" ng-options="x.value as x.text for x in carrierCategoryDropDown" required>
                                    <option value="">请选择</option>
                                </select>
                            </div>
                            <label class="w-s pull-left control-label">装车效果</label>
                            <div class="col-lg-2">
                                <input id="inquiryAdd_loadingEffect" name="loadingEffect" type="text" class="form-control input-sm" ng-model="loadingEffect" placeholder="请填写装车效果">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="panel-heading font-bold m-b-sm">
                                附件信息
                            </div>
                            <div class="col-md-4 m-l-xs">
                                <label class="pull-left m-l m-r">附件上传</label>
                               
                                <div class="col-md-3 form-group">
                                    <input id="inquiryAdd_attachmentUploader" name="attachmentUploader" type="file" file-read uploader="attachmentUploader" multiple />
                                </div>
                            </div>
                            <div class="wrapper-sm">
                                <div class="line  pull-in"></div>
                                <div class="wrapper-sm bg-light dk b-b m-b-xs hidden">
                                    <span class="">上传文件数: <b class="badge bg-info">{{ attachmentUploader.queue.length }}</b></span>
                                </div>
                                <table class="table bg-white-only b-a">
                                    <thead>
                                        <tr>
                                            <th width="50%">名称</th>
                                            <th >大小</th>
                                            <th >进度</th>
                                            <th>状态</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr ng-repeat="item in attachmentUploader.queue">
                                            <td>
                                                <strong>{{item.fileName|| item.fileName }}</strong>
                                            </td>
                                            <td  nowrap>{{ item.fileSize/1024/1024|number:2 }} MB</td>
                                            <td >
                                                <div class="progress" style="margin-bottom: 0;">
                                                    <div class="progress-bar" role="progressbar" ng-style="{ 'width': item.progress + '%' }"></div>
                                                </div>
                                            </td>
                                            <td class="text-center">
                                                <span ng-show="item.isSuccess"><i class="glyphicon glyphicon-ok"></i></span>
                                                <span ng-show="item.isCancel"><i class="glyphicon glyphicon-ban-circle"></i></span>
                                                <span ng-show="item.isError"><i class="glyphicon glyphicon-remove"></i></span>
                                            </td>
                                            <td nowrap>
                                                <button id="inquiryAdd_upload" class="btn btn-success btn-xs" ng-click="attachmentUploader.upload(item)" ng-disabled="item.isReady || item.isUploading || item.isSuccess">
                                                    <span class="glyphicon glyphicon-upload"></span> 上传
                                                </button>
                                                <button id="inquiryAdd_onDelete" class="btn btn-danger btn-xs" ng-click="[attachmentUploader.onDelete(item)]">
                                                    <span class="glyphicon glyphicon-trash"></span> 删除
                                                </button>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                                <button id="inquiryAdd_uploadAll" class="btn btn-sm btn-addon btn-success" ng-click="attachmentUploader.uploadAll()" ng-disabled="!attachmentUploader.getNotUploadedItems().length">
                                    <i class="fa fa-arrow-circle-o-up"></i> 全部上传
                                </button>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-1 pull-left control-label">备注</label>
                            <div class="col-lg-10">
                                <textarea class="form-control" ng-disabled="editInquiryDis" ng-model="attachmentDetails" placeholder="请填写备注" name="attachmentDetails"></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-1 pull-left control-label"></label>
                            <div class="col-lg-2">
                                <button id="inquiryAdd_addChild" class="btn btn-sm btn-info btn-addon" ng-show="inquiryChildShow" ng-disabled="!inquiryForms.$valid" ng-click="addInquiryChild()"><i class="fa fa-plus"></i>新增</button>
                            </div>
                        </div>
                        <div class="form-group" ng-show="inquiryChildShow">
                            <div class="panel-heading font-bold m-b-sm">
                                子询价单列表
                            </div>
                            <div class="wrapper-sm">
                                <div class="table-responsive table-cel-k">
                                    <table class="table-bordered table-hover">
                                        <thead class="table-thea">
                                            <tr>
                                                <th width="9%">发货地址</th>
                                                <th width="9%">送货地址</th>
                                                <th width="9%">货物名称</th>
                                                <th width="9%">货物数量</th>
                                                <th width="9%">预计发货时间</th>
                                                <th width="9%">预计到货时间</th>
                                                <th width="9%">所需车型</th>
                                                <th width="9%">所需车长</th>
                                                <th width="5%">操作</th>
                                            </tr>
                                        </thead>
                                        <tbody class="tab-tbod">
                                            <tr ng-repeat="item in inquiryChildViewList" title="{{item.shipAddress}}  {{item.deliveryAddress}}  {{item.goodsName}}  {{item.goodsNum + item.goodsQuantity}}{{item.plannedArrivalTime}}  {{item.plannedDeliveryTime}}  {{item.carType}}  {{item.carLength}}">
                                                <td>{{item.shipAddress}}</td>
                                                <td>{{item.deliveryAddress}}</td>
                                                <td>{{item.goodsName}}</td>
                                                <td>{{item.goodsQuantity}}</td>
                                                <td>{{item.plannedArrivalTime}}</td>
                                                <td>{{item.plannedDeliveryTime}}</td>
                                                <td>{{item.carType}}</td>
                                                <td>{{item.carLength}}</td>
                                                <td>
                                                    <a data-toggle="modal" title="删除" data-target="#lineprice" class="fa fa-trash-o m-l-xs primary text-info" ng-click="delInquiryChild(item.index,item.entity)"></a>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <!--<div class="table-responsive">
									<div ui-grid="inquiryChildViewList" ui-grid-auto-resize style="height:{{heightI}}px; min-height:35px; min-width:1000px;overflow:hidden">
										<div class="watermark" ng-if="!inquiryChildViewList.data.length">暂无数据</div>
									</div>
								</div>-->
                            </div>
                        </div>
                        <div class="form-group" ng-show="remarksShow">
                            <div class="panel-heading font-bold m-b-sm">
                                备注信息
                            </div>
                            <label class="m-l-xxl pull-left control-label">备注</label>
                            <div class="col-lg-10">
                                <textarea class="form-control" ng-model="remarks" placeholder="请填写备注" name="remarks"></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-5">
                                <button id="inquiryAdd_release" class="pull-right-xs btn btn-sm btn-primary btn-addon" ng-disabled="saveDis" ng-click="inquirySave()"><i class="fa fa-check"></i>询价发布</button>
                                <button id="inquiryAdd_cancel" ui-sref="app.inquiry.inquiryList({name:'inquiry'})" class="pull-right-xs btn btn-sm btn-info btn-addon "><i class="fa fa-reply"></i>返回</button>
                            </div>
                        </div>
                    </ng-form>
                </form>
            </div>
        </div>

    </div>
</div>